#include <stdio.h>
#include <string.h>

char* ystrcpy(char* des, const char* src)
{
    if (des == NULL || src == NULL)
	{
		return NULL;
	}

    char* pTmp = des;
    while((*des++ = *src++) != 0)
    {

    }

    return pTmp;
}

void* ymemcpy(void* des, const void* src, size_t len)
{
    if (des == NULL || src == NULL)
	{
		return NULL;
	}

    char* tempSrc = (char*)src;
    char* tempDes = (char*)des;

    while(len-- > 0)
    {
        *tempDes++ = *tempSrc++;
    }

    return des;
}

char* ystrcpy_s(char* des, size_t des_len, const char* src)
{
    if (des == NULL || src == NULL)
	{
		return NULL;
	}

    char* pTmp = des;
    while((*des++ = *src++) != 0)
    {

    }

    return pTmp;
}

int main(int argc, const char** argv) {
    char des[30];
    char src[30];
    memset(des, 0, sizeof(des));
    printf("%s\n", des);
    ystrcpy(des, "qwqw cdt");
    printf("%s\n", des);
    ymemcpy(des, "qweegytrytt", 5);
    printf("%s\n", des);
    return 0;
}